#ifndef TMCURVE_H
#define TMCURVE_H

#include <QWidget>
#include "ui_tmcurve.h"
#include "graphshow.h"
#include "rectimageprogress.h"
#include <QListView>

#include <qwt_plot.h>
#include <qwt_plot_marker.h>
#include <qwt_plot_curve.h>
#include <qwt_legend.h>
#include <qwt_point_data.h>
#include <qwt_plot_canvas.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_magnifier.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_picker.h>
#include <qwt_plot_zoomer.h>
#include <qwt_plot_panner.h>
#include <qwt_plot_magnifier.h>
#include <qwt_symbol.h>


class TmCurve : public QWidget
{
	Q_OBJECT

public:
	TmCurve(QWidget *parent = 0);
	~TmCurve();
	void uiInitial();
	void rect2Tmui(QRect rect);
	void peakvalShow(QVector<int> vector);
	void getPeakVal();

	public slots:
	void updateTmPic(QPixmap pixmap);
	//void updateRectangle(QRect rect);
	void startReplot();
	void stopRplot();
	void updateTmIma(QImage ima);
	void updateCurve(QPolygonF pos);
	void peakValue();
signals:
	void sendRect(QRect re);
protected:
	void timerEvent(QTimerEvent *e);

private:
	Ui::TmCurve ui;
	bool redata_state;
	QImage tm_reimage;
	QPixmap tm_repixmap;
	QVector<int> peak_value;
	QRect tm_gra_rectangle;
	
	RectImageProgress tm_rectimage;
	bool current_cur_state;
	QMutex mutex;
	QThread rectProThread;
	QWidget childwindow;
	bool peak_val_state;
	QTimer timer;
};

#endif // TMCURVE_H
